package com.qf.admin.controller;


import com.qf.admin.domain.Address;
import com.qf.admin.service.IAddressService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Random;

@RestController
@RequestMapping("/address")
public class AddressController2 {

    private IAddressService addressService;

    public AddressController2(IAddressService addressServiceImpl) {
        this.addressService = addressServiceImpl;
    }

    //获取用户的收货地址123
    @GetMapping("/{id}")
    public List<Address> getReceiptAddress(@PathVariable("id") Integer id){

        List<Address> receiptAddress = addressService.getReceiptAddress(id);

        return receiptAddress;
    }

    public static void main(String[] args) {
        String phone="13763098631";
        Random random = new Random();
        int ends = random.nextInt(99);
        String format = String.format("%02d", ends);
        System.out.println(phone.substring(phone.length() - 4)+format);

    }
}
